package com.thoughtworks.Java.service;

import com.thoughtworks.Java.model.Customer;
import com.thoughtworks.Java.repository.CustomerRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by yrzhang on 10/9/16.
 */
public class CustomerServiceImpl implements CustomerService {
    private CustomerRepository customerRepository;

    @Value("${name}")
    private String name;

    public String getName(){return name;}


    public CustomerServiceImpl(CustomerRepository customerRepository) {
        System.out.println("We are using constructor injection");
        this.customerRepository = customerRepository;
    }

    public List<Customer> findAll() {
        return customerRepository.findAll();
    }

}
